#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Time    : 2022/5/5 15:16
# @File    : testmysql
# @Software: Pycharm

import sys

sys.path.append("/opt/apps/python/lib/python3.5/site-packages")
sys.path.append("/opt/apps/python")
import pymysql

host = '127.0.0.1'
user = 'test'
pwd = 'test'
port = 3306
table = 'test_table'
# host = '192.168.3.224'
database = 'test_db'
MYSQL_TIMEOUT = 30
dbtype = 1

mysql_conn = pymysql.connect(host=host,port=port,user=user,password=pwd,database=database)
cursor = mysql_conn.cursor()
res = cursor.execute("select id from test_table")
res = cursor.rowcount
print(res)
for i in range(res):
    one = cursor.fetchone()
    print(one)
